package 异常.demo2;
//克隆：23种设计模式之原型模式
public class Test {
    public static void main(String[] args) {
        Dog d1=new Dog();
        d1.name="dog1";

        Dog d2=null;
        try {
            d2=(Dog)d1.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }

        d2.name="dog2";
        System.out.println(d1.name);
        System.out.println(d2.name);

    }
}
